package com.phy.mail.servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class update
 */
public class vertify extends HttpServlet {
	private static final long serialVersionUID = 1L;
    public vertify() {
        super();
    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String user=request.getParameter("user").trim();
		String password=request.getParameter("password").trim();
		HttpSession session=request.getSession();
		System.out.println("the uesr is:"+user);
		System.out.println("the password is:"+password);
		PrintWriter out = response.getWriter();
		if(user.equals("ym") && password.equals("mt0604xt")){
			out.print("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
			out.print("<html xmlns=http://www.w3.org/1999/xhtml>");
			out.print("<head>");
			out.print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />");
			out.print("<title>更新映射表</title>");
			out.print("<link href='css/base.css' type='text/css' rel='stylesheet' />");
			out.print("<link href='css/common.css' type='text/css' rel='stylesheet'/>");
			out.print("<link href='css/update.css' type='text/css' rel='stylesheet' />");
			out.print("<script type='text/javascript' src='js/jquery-1.6.1.min.js'></script>");
			out.print("<script type='text/javascript' src='js/update.js'></script>");
			out.print("</head>");
			out.print("<body>");
			out.print("<div class='content'>");
			out.print("<div id='message'></div>");
			out.print("<div style='height: 20px;'></div>");
			out.print("<h2>更新mx记录</h2><form><table><tr><th>mx记录</th><th>对应的邮件系统</th></tr>");
			out.print("<tr><td><input type='text' id='m'/> </td><td><input type='text' id='s'/></td></tr>");
			out.print("<tr><td><input type='button' class='act' value='提交更新mx记录' onclick='updateMX();'/></td></tr>");
			out.print("</table></form>");
			out.print("<div style='height: 20px;'></div>");
			out.print("<h2>更新返回值关键词</h2><form><table><tr><th>返回值关键词</th><th>对应的邮件系统</th></tr>");
			out.print("<tr><td><input type='text' id='a'/> </td><td><input type='text' id='k'/></td></tr>");
			out.print("<tr><td><input type='button' class='act' value='提交更新关键词' onclick='updateBack();'/></td></tr>");
			out.print("</table></form></div></body></html>");
		}
		else{
			request.setAttribute("msg", "Sorry,请重新输入账号密码!");
			request.getRequestDispatcher("/vertify.jsp").forward(request, response);
		}
	}

}
